<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qtcolorcombobox-2.4_1-opensource/src/qtcolorcombobox.cpp -->
<head>
  <title>QtColorComboBox Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
</tr></table><h1 class="title">QtColorComboBox Class Reference</h1>
<p>The QtColorComboBox class provides a combobox with colors and texts. <a href="#details">More...</a></p>
<pre> #include &lt;QtColorComboBox&gt;</pre><p>Inherits <a href="http://qt.nokia.com/doc/4.5/qcombobox.html">QComboBox</a>.</p>
<ul>
<li><a href="qtcolorcombobox-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"></div><b><a href="qtcolorcombobox.html#QtColorComboBox">QtColorComboBox</a></b> ( QWidget * <i>parent</i> = 0, const char * <i>name</i> = 0 )</li>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#addColor">addColor</a></b> ( const QColor &amp; <i>color</i>, const QString &amp; <i>name</i> )</li>
<li><div class="fn"></div>QColor <b><a href="qtcolorcombobox.html#color">color</a></b> ( int <i>index</i> ) const</li>
<li><div class="fn"></div>int <b><a href="qtcolorcombobox.html#colorCount">colorCount</a></b> () const</li>
<li><div class="fn"></div>QColor <b><a href="qtcolorcombobox.html#currentColor">currentColor</a></b> () const</li>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#insertColor">insertColor</a></b> ( int <i>index</i>, const QColor &amp; <i>color</i>, const QString &amp; <i>name</i> )</li>
<li><div class="fn"></div>bool <b><a href="qtcolorcombobox.html#isColorDialogEnabled">isColorDialogEnabled</a></b> () const</li>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#setColorDialogEnabled">setColorDialogEnabled</a></b> ( bool <i>enabled</i> = true )</li>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#setCurrentColor">setCurrentColor</a></b> ( const QColor &amp; <i>color</i> )</li>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#setStandardColors">setStandardColors</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"></div>55 public functions inherited from <a href="http://qt.nokia.com/doc/4.5/qcombobox.html#public-functions">QComboBox</a></li>
<li><div class="fn"></div>207 public functions inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"></div>12 public functions inherited from <a href="http://qt.nokia.com/doc/4.5/qpaintdevice.html#public-functions">QPaintDevice</a></li>
<li><div class="fn"></div>29 public functions inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h3>Signals</h3>
<ul>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#activated">activated</a></b> ( const QColor &amp; <i>color</i> )</li>
<li><div class="fn"></div>void <b><a href="qtcolorcombobox.html#highlighted">highlighted</a></b> ( const QColor &amp; <i>color</i> )</li>
</ul>
<ul>
<li><div class="fn"></div>7 signals inherited from <a href="http://qt.nokia.com/doc/4.5/qcombobox.html#signals">QComboBox</a></li>
<li><div class="fn"></div>1 signal inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#signals">QWidget</a></li>
<li><div class="fn"></div>1 signal inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>13 properties inherited from <a href="http://qt.nokia.com/doc/4.5/qcombobox.html#properties">QComboBox</a></li>
<li><div class="fn"></div>57 properties inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#properties">QWidget</a></li>
<li><div class="fn"></div>1 property inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#properties">QObject</a></li>
<li><div class="fn"></div>4 public slots inherited from <a href="http://qt.nokia.com/doc/4.5/qcombobox.html#public-slots">QComboBox</a></li>
<li><div class="fn"></div>19 public slots inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"></div>1 public slot inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#public-slots">QObject</a></li>
<li><div class="fn"></div>1 public type inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#public-variables">QObject</a></li>
<li><div class="fn"></div>4 static public members inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"></div>4 static public members inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>1 protected function inherited from <a href="http://qt.nokia.com/doc/4.5/qcombobox.html#protected-functions">QComboBox</a></li>
<li><div class="fn"></div>37 protected functions inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"></div>1 protected function inherited from <a href="http://qt.nokia.com/doc/4.5/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"></div>1 protected slot inherited from <a href="http://qt.nokia.com/doc/4.5/qwidget.html#protected-slots">QWidget</a></li>
<li><div class="fn"></div>1 protected type inherited from <a href="http://qt.nokia.com/doc/4.5/qpaintdevice.html#protected-variables">QPaintDevice</a></li>
<li><div class="fn"></div>2 protected variables inherited from <a href="http://qt.nokia.com/doc/4.5/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QtColorComboBox class provides a combobox with colors and texts.</p>
<p>Colors are inserted with <a href="qtcolorcombobox.html#insertColor">insertColor</a>(), which takes a color, a text, and an optional index position. The combobox can also be populated with a standard set of colors using <a href="qtcolorcombobox.html#setStandardColors">setStandardColors</a>(). Users can add their own colors if the color dialog is enabled (see <a href="qtcolorcombobox.html#setColorDialogEnabled">setColorDialogEnabled</a>()).</p>
<p>When a color is highlighted (for example when the mouse moves over it after the combobox has been dropped down), the <a href="qtcolorcombobox.html#highlighted">highlighted</a>() signal is emitted. When a color is activated (for example, clicked), the <a href="qtcolorcombobox.html#activated">activated</a>() signal is emitted. If the color dialog is enabled and the item clicked is the &quot;More..&#x2e;&quot; item at the end, the color dialog is popped up and if the user chooses a color the activated signal is emitted after the dialog closes.</p>
<p>Use <a href="qtcolorcombobox.html#color">color</a>() to get the color at a certain index position, and <a href="qtcolorcombobox.html#currentColor">currentColor</a>() to get the color that is currently selected.</p>
<p align="center"><img src="images/qtcolorcombobox.png" /></p><hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QtColorComboBox"></a>QtColorComboBox::QtColorComboBox ( <a href="http://qt.nokia.com/doc/4.5/qwidget.html">QWidget</a> * <i>parent</i> = 0, const char * <i>name</i> = 0 )</h3>
<p>Constructs a <a href="qtcolorcombobox.html">QtColorComboBox</a> with the color dialog disabled. The <i>parent</i> and <i>name</i> arguments are passed to the <a href="http://qt.nokia.com/doc/4.5/qcombobox.html">QComboBox</a>'s constructor.</p>
<h3 class="fn"><a name="activated"></a>void QtColorComboBox::activated ( const <a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> &amp; <i>color</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when the color <i>color</i> has been activated.</p>
<h3 class="fn"><a name="addColor"></a>void QtColorComboBox::addColor ( const <a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> &amp; <i>color</i>, const <a href="http://qt.nokia.com/doc/4.5/qstring.html">QString</a> &amp; <i>name</i> )</h3>
<p>Appends the color <i>color</i> with the text <i>name</i> to the combobox.</p>
<h3 class="fn"><a name="color"></a><a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> QtColorComboBox::color ( int <i>index</i> ) const</h3>
<p>Returns the color at position <i>index</i>.</p>
<h3 class="fn"><a name="colorCount"></a>int QtColorComboBox::colorCount () const</h3>
<p>This function returns the number of colours in the combobox. (excluding the &quot;More..&#x2e;&quot;)</p>
<h3 class="fn"><a name="currentColor"></a><a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> QtColorComboBox::currentColor () const</h3>
<p>Returns the current color.</p>
<p>See also <a href="qtcolorcombobox.html#setCurrentColor">setCurrentColor</a>().</p>
<h3 class="fn"><a name="highlighted"></a>void QtColorComboBox::highlighted ( const <a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> &amp; <i>color</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when the color <i>color</i> has been highlighted on the popup color grid.</p>
<h3 class="fn"><a name="insertColor"></a>void QtColorComboBox::insertColor ( int <i>index</i>, const <a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> &amp; <i>color</i>, const <a href="http://qt.nokia.com/doc/4.5/qstring.html">QString</a> &amp; <i>name</i> )</h3>
<p>Inserts the color <i>color</i> with the text <i>name</i> at position <i>index</i>.</p>
<p>If <i>index</i> is -1, then color is prepended to the beginning end of the list.</p>
<h3 class="fn"><a name="isColorDialogEnabled"></a>bool QtColorComboBox::isColorDialogEnabled () const</h3>
<p>Returns true if the color dialog button is enabled; otherwise returns false.</p>
<h3 class="fn"><a name="setColorDialogEnabled"></a>void QtColorComboBox::setColorDialogEnabled ( bool <i>enabled</i> = true )</h3>
<p>Enables the color dialog if <i>enabled</i> is true; otherwise disables it.</p>
<p>When the color dialog is enabled, an extra item is available at the bottom of the list of colors in the combobox with the translatable text &quot;More..&#x2e;&quot;&#x2e; Selecting this item will pop up the color dialog, allowing the user to add new colors to the list. The new colors will be called &quot;User color 1&quot;, &quot;User color 2&quot;, and so on; the names can be changed by translating &quot;User color %1&quot;.</p>
<p>See also <a href="qtcolorcombobox.html#isColorDialogEnabled">isColorDialogEnabled</a>() and <a href="qtcolorcombobox.html#insertColor">insertColor</a>().</p>
<h3 class="fn"><a name="setCurrentColor"></a>void QtColorComboBox::setCurrentColor ( const <a href="http://qt.nokia.com/doc/4.5/qcolor.html">QColor</a> &amp; <i>color</i> )</h3>
<p>Sets <i>color</i> to be the current color if <i>color</i> is one of the combobox's colors; otherwise does nothing.</p>
<p>See also <a href="qtcolorcombobox.html#currentColor">currentColor</a>() and <a href="qtcolorcombobox.html#insertColor">insertColor</a>().</p>
<h3 class="fn"><a name="setStandardColors"></a>void QtColorComboBox::setStandardColors ()</h3>
<p>Adds the 17 predefined colors from the Qt namespace.</p>
<p>(The names given to the colors, &quot;Black&quot;, &quot;White&quot;, &quot;Red&quot;, etc., are all translatable.)</p>
<p>See also <a href="qtcolorcombobox.html#insertColor">insertColor</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
</tr></table></div></address></body>
</html>
